﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using DatabaseEntegreItri.DataModel;

namespace DatabaseEntegreItri
{
    /// <summary>
    /// Interaction logic for LogScreen.xaml
    /// </summary>
    public partial class LogScreen : Window
    {
        public LogScreen()
        {
            InitializeComponent();
            updateList();
                     
        }
        private void updateList() {

            listBox.Items.Clear();
            int counter = 0;
            foreach (String str in Logs.logList)
            {
                listBox.Items.Add((counter++)+" - " + str);
            }
            try
            {
                object item = listBox.Items.GetItemAt(listBox.Items.Count - 1);
                listBox.ScrollIntoView(item);
            }
            catch (Exception){}  
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            Logs.logList.Clear();
            updateList();
        }
    }
}
